package Plugin_Reprise.editors.my_sql_editor;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IDocumentPartitioner;
import org.eclipse.ui.editors.text.FileDocumentProvider;

public class SQLDocumentProvider extends FileDocumentProvider {

	@Override
	protected IDocument createDocument(Object element) throws CoreException {
	    IDocument document = super.createDocument(element);
	    if (document != null)
	    {
	        IDocumentPartitioner partitioner = new SQLPartitionner(
	        new EditorPartitionScannerSQL(), new String[]                            
	          {
	        	EditorPartitionScannerSQL.SQL_TAG, 
	        	EditorPartitionScannerSQL.SQL_COMMENT,
	        	EditorPartitionScannerSQL.SQL_SEPARATOR,
	        	EditorPartitionScannerSQL.SQL_ALIAS,
	        	EditorPartitionScannerSQL.SQL_TableUV
	          });
	        partitioner.connect(document);
	        document.setDocumentPartitioner(partitioner);
	    }
	 
	    return document;

	}

	
	
}
